<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="description"
        content="BiasEdit: Debiasing Stereotyped Language Models via Model Editing">
  <meta name="keywords" content="model editing, debiasing, bias, knowledge editing">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>BiasEdit: Debiasing stereotyped language models via model editing</title>

  <!-- Global site tag (gtag.js) - Google Analytics -->
  <!-- <script async src="https://www.googletagmanager.com/gtag/js?id=G-PYVRSFMDRL"></script> -->
  <script>
    window.dataLayer = window.dataLayer || [];

    function gtag() {
      dataLayer.push(arguments);
    }

    gtag('js', new Date());

    gtag('config', 'G-PYVRSFMDRL');
  </script>

  <link href="https://fonts.googleapis.com/css?family=Google+Sans|Noto+Sans|Castoro"
        rel="stylesheet">

  <link rel="stylesheet" href="./static/css/bulma.min.css">
  <link rel="stylesheet" href="./static/css/bulma-carousel.min.css">
  <link rel="stylesheet" href="./static/css/bulma-slider.min.css">
  <link rel="stylesheet" href="./static/css/fontawesome.all.min.css">
  <link rel="stylesheet"
        href="https://cdn.jsdelivr.net/gh/jpswalsh/academicons@1/css/academicons.min.css">
        <link rel="icon" href="./static/images/hammer1.png">
  <link rel="stylesheet" href="./static/css/index.css">

  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
  <script defer src="./static/js/fontawesome.all.min.js"></script>
  <script src="./static/js/bulma-carousel.min.js"></script>
  <script src="./static/js/bulma-slider.min.js"></script>
  <script src="./static/js/index.js"></script>

  <style>
		/* Define the grid layout */
		.mygrid {
			display: grid;
			grid-template-columns: repeat(3, 1fr);
			grid-gap: 20px;
			width: 80%;
			margin: auto;
		}
		.grid_item {
      background: #FFFFFF;
      opacity: 1;
    }

		/* Define the size of the GIFs */
		.mygif {
			height: auto;
			cursor: pointer;
		}
		
		/* Define the modal styles */
		.modal {
			display: none;
			position: fixed;
			z-index: 1;
			left: 0;
			top: 0;
			width: 100%;
			height: 100%;
			overflow: auto;
			background-color: rgba(0,0,0,0.9);
		}
		
		.modal-content {
			margin: auto;
			display: block;
			width: 80%;
			max-width: 800px;
			max-height: 80%;
		}

    /* Define the full-screen overlay styles */
		.overlay {
			position: fixed;
			z-index: 999;
			left: 0;
			top: 0;
			width: 100%;
			height: 100%;
			overflow: hidden;
			background-color: rgba(0,0,0,0.9);
			display: none;
		}
		
		.overlay img {
			width: auto;
			height: 90%;
			margin: 0 auto;
			display: block;
			max-width: 90%;
			max-height: 90%;
		}

    /* Define the video styles */
		.gifvideo {
			width: 100%;
			height: auto;
		}

		/* Define the progress bar styles */
		.progress {
			width: 100%;
			height: 10px;
			background-color: #ddd;
			position: relative;
		}

		.progress-bar {
			height: 100%;
			background-color: #4CAF50;
			position: absolute;
			top: 0;
			left: 0;
		}
		
		/* Define the close button style */
		.close {
			color: white;
			position: absolute;
			top: 10px;
			right: 25px;
			font-size: 35px;
			font-weight: bold;
			cursor: pointer;
		}
		
		.close:hover,
		.close:focus {
			color: #bbb;
			text-decoration: none;
			cursor: pointer;
		}
	</style>

  <style>
    /* 容器，用于并排放置图片 */
    .image-container-loss {
        display: flex;
        justify-content: center; /* 使图片居中对齐 */
    }
    /* 图片样式，可根据需要调整间距等 */
    .image-container-loss img {
        margin-right: 40px; /* 在图片之间添加一些间距 */
    }
    /* 最后一张图片不需要右边距 */
    /* .image-container img:last-child {
        margin-right: 0;
    } */
  </style>



  </head>
<body>


<section class="hero">
  <div class="hero-body">
    <div class="container is-max-desktop">
      <div class="columns is-centered">
        <div class="column has-text-centered">
          <h2 class="title is-2 publication-title" style="width: 110%; margin-left: -5%">BiasEdit: Debiasing Stereotyped Language Models via Model Editing</h2>
          <div class="is-size-5">
            <span class="author-block" style="color:#00A4EF;font-weight:normal;">
              Xin Xu<sup>1</sup>
            </span>,
            <span class="author-block" style="color:#00A4EF;font-weight:normal;">
              Wei Xu<sup>2</sup>
            </span>,
            <span class="author-block" style="color:#00A4EF;font-weight:normal;">
              Ningyu Zhang<sup>3</sup>
            </span>,
            <span class="author-block" style="color:#00A4EF;font-weight:normal;">
              Julian McAuley<sup>1</sup>
            </span>
          </div>

          <br>
          <div class="is-size-5 publication-authors">
            <span class="author-block">
              <sup>1</sup>UC San Diego
            </span>
            <span class="author-block">
              <sup>2</sup>Georgia Institute of Technology
            </span>
            <span class="author-block">
              <sup>3</sup>Zhejiang University
            </span>
          </div>

<!--           <div class="is-size-5 publication-authors">
            <span class="author-block"><sup>*</sup>Corresponding Author</span>
           
          </div> -->

          <div class="column has-text-centered">
            <div class="publication-links">
              <!-- PDF Link. -->
              <span class="link-block">
                <a href="https://arxiv.org/abs/2503.08588" target="_blank" 
                   class="external-link button is-normal is-rounded is-dark">
                  <span class="icon">
                      <i class="ai ai-arxiv"></i>
                  </span>
                  <span>TrustNLP @ NAACL 2025</span>
                </a>
              </span>
              <!-- Code Link. -->
              <span class="link-block">
                <a href="https://github.com/zjunlp/BiasEdit" target="_blank" 
                   class="external-link button is-normal is-rounded is-dark">
                  <span class="icon">
                      <i class="fab fa-github"></i>
                  </span>
                  <span>Code</span>
                  </a>
              </span>
              <!-- Twitter Link. -->
              <!-- <span class="link-block">
                <a href="https://twitter.com/zxlzr/status/1745412748023128565" target="_blank" 
                   class="external-link button is-normal is-rounded is-dark">
                  <span class="icon">
                    <p style="font-size:18px">🌐</p>
                  </span>
                  <span>Twitter</span>
                </a>
              </span> -->
            </div>

          </div>
        </div>
      </div>
    </div>
  </div>
</section>

<section class="hero teaser">
  <div class="container is-max-desktop">
    <div class="hero-body">
      <div class="has-text-centered"> <!-- Add the has-text-centered class here -->
        <img id="teaser" width="70%" src="./images/BiasEdit_fig1.gif">
      </div>
      <br>
      <h2 class="subtitle has-text-centered">
        <strong>BiasEdit</strong> is an efficient model editing method to eliminate stereotyped bias from language models with small editor networks, including a debiasing loss to guide edits on partial parameters and a remaining loss to maintain the language modeling abilities during editing. Experiments show its excellent performance on debiasing, language ability preservation, and robustness of gender reverse and semantic generality.
      </h2>
    </div>
  </div>
</section>

<section class="section">
  <div class="container is-max-desktop">
    <!-- Abstract. -->
    <div class="columns is-centered has-text-centered">
      <div class="column is-four-fifths">
        <h2 class="title is-3">Abstract</h2>
        <div class="content has-text-justified">
          <p>
            Previous studies have established that pre-trained language models inherently manifest various bias.
Although several debiasing strategies, such as retraining a whole model with counterfactual data, prompt tuning, and representation projection, have been introduced, they often fall short of efficiently eliminating bias or directly altering the models' biased essence.
To address these issues, we propose <b>BiasEdit</b>, an efficient model editing method to remove stereotyped bias from language models with small editor networks.
It contains a debiasing loss to guide editor networks to conduct local edits on partial parameters for debiasing, and a remaining loss to preserve the original language modeling abilities of language models during editing. 
Experiments demonstrate the high effectiveness and robustness of <b>BiasEdit</b> in eliminating bias compared to classical debiasing baselines, and its little impact on the language modeling and general capabilities of models.
In addition, we conduct bias tracing and explore the effects of bias and debiasing via editing on language models.
          </p>
        </div>
      </div>
    </div>
    <!--/ Abstract. -->
    <br>
    <br>
    <!-- Paper Model. -->
    <div class="columns is-centered has-text-centered">
      <div class="column is-six-fifths">
        <h2 class="title is-3">BiasEdit</h2>
        <img id="model" width="100%" src="images/BiasEdit_fig2.png">
        <p class="has-text-centered">
          Figure 1: Debiasing a language model with <b>BiasEdit</b>. s: stereotyped. a: anti-stereotyped. m: meanless.
        </p>
        <br>
        <div class="column has-text-justified">
          As shown in Figure 1, BiasEdit utilizes trained editor networks to produce parameter shifts for editing partial parameters of a language model. 
          During debiasing, the debiasing loss guides the editor networks to produce parameter edits. The remaining loss preserves the original language modeling abilities of the model.
           After editing, an unbiased language model is obtained with the robustness of general capabilities, gender reverse and semantic generality. 
        </div>
        <div class="image-container-loss">
          <img src="images/debiasingloss.png" width="35%" alt="Debiasing Loss">
          <img src="images/retentionloss.png" width="35%" style="height: auto;" alt="Retention Loss">
      </div>
      </div>
    </div>
    <br>
    <br>
    <!-- Paper Model. -->
    
    <!-- Paper Main Results -->
    <div class="columns is-centered has-text-centered">
      <div class="column is-six-fifths">
        <h2 class="title is-3">Main Results</h2>
        <img id="model" width="100%" src="images/main_result.png">
        <br>
        <!-- <p class="has-text-centered">
          Table 1: Performance of <b>BiasEdit</b> compared with various debiasing baselines.
          <i>Pre-edit</i> represents the exact <i>SS</i> and <i>LMS</i> of pre-trained language models before debiasing. &Delta;<i>LMS</i> (%) refers to the change in <i>LMS</i> (%) during debiasing.
        </p> -->
        <br>
      </div>
    </div>
    <br>
    <br>
    <!-- Paper Main Results -->

    <!-- Paper Analysis -->
    <div class="columns is-centered has-text-centered">
      <div class="column is-six-fifths">
        <!-- <h2 class="title is-3">Analysis</h2> -->
        <h2 class="title is-3-1">Ablation Study on Retention Loss</h2>
        <img id="model" width="50%" src="images/ablation.png">
        <br>
        <br>
        <br>
        <h2 class="title is-3-2">Edits on different blocks</h2>
        <img id="model" width="100%" src="images/differentlayer.png">
        <br>
        <br>
        <br>
        <h2 class="title is-3-2">Impacts on General Capabilities</h2>
        <img id="model" width="100%" src="images/general.png">
        <br>
        <br>
        <br>
        <h2 class="title is-3-3">Reversing Gender Attribute Words</h2>
        <img id="model" width="55%" src="images/gender_reverse.png">
        <br>
        <br>
        <br>
        <h2 class="title is-3-4">Semantic Generality</h2>
        <img id="model" width="60%" src="images/semantic.png">
      </div>
    </div>
    <!-- Paper Analysis. -->
  </div>
</section>


<section class="section" id="BibTeX">
  <div class="container is-max-desktop content">
    <h2 class="title">BibTeX</h2>
    <pre><code>
@article{xin25biasedit,
  author       = {Xin Xu, Wei Xu, Ningyu Zhang, Julian McAuley},
  title        = {BiasEdit: Debiasing Stereotyped Language Models via Model Editing},
  year         = {2025},
  url          = {https://github.com/zjunlp/BiasEdit}
}

</code></pre>
  </div>
</section>

<section class="section" id="Acknowledgement">
  <div class="container is-max-desktop content">
    <p>
      This website is adapted from <a
      href="https://github.com/nerfies/nerfies.github.io">Nerfies</a>, licensed under a <a rel="license"
                                          href="http://creativecommons.org/licenses/by-sa/4.0/">Creative
      Commons Attribution-ShareAlike 4.0 International License</a>.
    </p>
  </div>
</section>


<script>
  $(".grid_item").hover(function () {
    $(this).css("background", "#f2f1f1");
    }, 
    function () {
        $(this).css("background", "#FFFFFF"); 
    });

  // Get the modal element
  // var modal = document.getElementById("myModal");
  var overlay = document.getElementById("overlay");
  var span = document.getElementsByClassName("close")[0];


  // Get the image element and the close button element
  //  // display the GIF as it is
  // var img = document.getElementById("modalImg");
  // var img = document.getElementById("overlayImg");
  // Add event listeners to each GIF element
  var gifs = document.getElementsByClassName("mygif");
  for (var i = 0; i < gifs.length; i++) {
  gifs[i].addEventListener("click", function() {
      //  // display the GIF as it is
      // // Set the modal image source and display the modal
      // img.src = this.src;

      // display the GIF as a new image, will play from the begining
      var img = document.createElement("img");
      img.src = this.src.replace(".png", ".gif");

      // Add the img element to the overlay content and display the overlay
      document.getElementById("overlayContent").appendChild(img);
      

      // modal.style.display = "block";
      overlay.style.display = "block";

      // Hide the body overflow
              document.body.style.overflow = "hidden";
  });
  }

  // Add event listener to close button
  span.addEventListener("click", function() {
  // Remove the img element from the overlay content, hide the overlay, and restore the body overflow
          document.getElementById("overlayContent").innerHTML = "";

  // Hide the modal
  // modal.style.display = "none";
  overlay.style.display = "none";
  document.body.style.overflow = "auto";
  });
</script>
</body>
</html>
